<div class="frame_right_table">
<?php echo CHtml::form(CHtml::normalizeUrl(array("announce/add")),$method='post',array('id'=>'announce_add'));?>
		<table class="tableForm" width="100%" cellspacing="0" cellpadding="0">
			<tr class="for_hover">
				<th width=150 >公告主题：</th>
				<td colspan="5"><input name='subject' id="subject" value=""/></td>
			</tr>
			<tr class="for_hover">
				<th width=150>发起人：</th>
				<td colspan="5"><?php echo isset($params['username'])?$params['user_name']:"王东明";?></td>
			</tr>
			<tr>
				<th width=150>公告内容：</th>
				<td colspan="5">
					<input type="hidden" id="image_id" name="image_id" value="" />
					<textarea id="xheditor" style="width:100%;height:200px" name="content"></textarea>
				</td>
			</tr>
			<tr>
				<th width=150>排序：</th>
				<td colspan="5">
					<input name='sort' id="sort" value=""/>
				</td>
			</tr>
			<tr class="for_hover">
				<th width=150>链接地址：</th>
				<td colspan="5"><input name='linked' id="linked_url" value="" maxlength="100"/>(注意：如果输入了链接地址，前台链接将直接跳转到链接页面)</td>
			</tr>
		</table>
		<div class="myclear"></div>
		<div class="list_page_1">
			<div style="float:left;margin:3px 0 0 170px;">		
				<?php echo CHtml::button('保存添加',array('class'=>'frame_button','id'=>'postsubmit'))?>
			</div>
		</div>
<?php echo CHtml::endForm();?>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
	$("#xheditor").xheditor({
        html5Upload: false,
        tools: "Cut,Copy,Paste,Pastetext,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Align,List,Outdent,Indent,Link,Unlink,Table,Source,Fullscreen,|",
        upImgUrl: "/product/upload",
        upImgExt: "jpg,jpeg,gif,png",
    });
    $("#postsubmit").click(function(){
        var okflag=false;
		if($("#subject").val()=="")
			alert("请输入主题");
		else if($("#xheditor").val()=="")
			alert("请输入公告内容");
		else
			okflag=true;
		if(okflag==true)
		{
			$("#announce_add").submit();			
		}
        });
});
function post()
{
	$.ajax({
		type:"POST",
		url:'<?php echo CHtml::normalizeUrl(array("announce/add"));?>',
		data:{'subject':$('#subject').val(),'content':$("#xheditor").val(),'sort':$("#sort").val(),
			'link':$("#linked_url").val()},
		success:function(data){alert(data);},
		error:function(data){alert("error");}
		});
}
</script>
